#########################################################################################
# Makefile in top dir，call Makefile in sub dirs
# Author: Bob <981378640@qq.com>
#
#########################################################################################

CUR_DIR := $(shell pwd)
#SUB_DIRS := $(shell ls -d */)
SOURCE_FILE_ROOT_DIR = ./src
SUB_DIRS := $(SOURCE_FILE_ROOT_DIR)/static \
    $(SOURCE_FILE_ROOT_DIR)/hello \
    $(SOURCE_FILE_ROOT_DIR)/dynamic \
    $(SOURCE_FILE_ROOT_DIR)/test \
    $(SOURCE_FILE_ROOT_DIR)/thread \
    $(SOURCE_FILE_ROOT_DIR)/pthread_cond \
    $(SOURCE_FILE_ROOT_DIR)/derived

######################do not modify following items ########################################
.PHONY : default all clean info  $(SUB_DIRS)

default : all

all :
	$(MAKE) $(SUB_DIRS) TARGET=$@

clean :  
	$(MAKE) $(SUB_DIRS) TARGET=$@

realclean :  
	$(MAKE) $(SUB_DIRS) TARGET=$@

$(SUB_DIRS) :
	$(MAKE) -C $@ $(TARGET)

info:
	@echo 'Current work dir:'$(CUR_DIR)
	@echo 'SUB_DIRS:'$(SUB_DIRS)
	@echo ' '
